package com.zyz.I_多线程.线程安全问题.引出;

/**
 * @author: vick
 * @Date: 2025/3/22
 * @Description:
 * @version: 1.0
 */
public class TicketTest {
    public static void main(String[] args) {
        Ticket ticket = new Ticket();


        Thread ticket1 = new Thread("牛逼的你") {
            @Override
            public void run() {
                while (true) {
                    ticket.sale();
                }
            }
        };


        Thread ticket2 = new Thread("苦逼的我") {
            @Override
            public void run() {
                while (true) {
                    ticket.sale();
                }
            }
        };

        Thread ticket3 = new Thread(new Runnable() {
            @Override
            public void run() {
                ticket.sale();
            }
        }, "黄牛");

        ticket1.start();
        ticket2.start();
        ticket3.start();
    }
}
